<!DOCTYPE html>
<!--[if IE 9]>         <html class="ie9 no-focus" lang="zh"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-focus" lang="zh"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">

        <title>大白家商城·管理系统</title>

        <meta name="description" content="">
        <meta name="robots" content="noindex, nofollow">
        <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0">

        <!-- Icons -->
        <!-- The following icons can be replaced with your own, they are used by desktop and mobile browsers -->
        <link rel="shortcut icon" href="__ADMIN_IMG__/favicons/favicon.ico">
        <link rel="icon" type="image/png" href="__ADMIN_IMG__/favicons/favicon-16x16.png" sizes="16x16">
        <link rel="icon" type="image/png" href="__ADMIN_IMG__/favicons/favicon-32x32.png" sizes="32x32">
        <!-- END Icons -->


        <!-- Stylesheets -->

        <!-- Page JS Plugins CSS -->
        <link rel="stylesheet" href="__LIBS__/sweetalert/sweetalert.min.css">

        <!-- Bootstrap and OneUI CSS framework -->
        <link rel="stylesheet" href="__ADMIN_CSS__/bootstrap.min.css">
        <link rel="stylesheet" id="css-main" href="__ADMIN_CSS__/oneui.css">
        <link rel="stylesheet" href="__ADMIN_CSS__/mind.css">
		<link rel="stylesheet" href="__LIBS__/layui/css/layui.css">
		<link rel="stylesheet" href="__ADMIN_CSS__/custom.css?v={:config('app.app.asset_version')}">
        <!-- END Stylesheets -->
    </head>
    <body>
        <!-- Login Content -->
        <div class="bg-white pulldown">
            <div class="content content-boxed overflow-hidden">
                <div class="row">
                    <div class="col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">
                        <div class="push-30-t push-50 animated fadeIn">
                            <!-- Login Title -->
                            <div class="text-center">
                                <img src="__ADMIN_IMG__/logo-signin.png" alt="大白家商城">
                                <p class="text-muted push-15-t">大白家商城·管理系统</p>
                            </div>
                            <!-- END Login Title -->

                            <!-- Login Form -->
                            <form class="js-validation-login form-horizontal push-30-t signin-form" name="signin-form" action="{:url('signin')}" method="post">
                                <div class="form-group">
                                    <label class="col-xs-12" for="login-username">用户名</label>
                                    <div class="col-xs-12">
                                        <input class="form-control" type="text" id="login-username" name="username" required="required" placeholder="请输入您的用户名">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-xs-12" for="login-password">密码</label>
                                    <div class="col-xs-12">
                                        <input class="form-control" type="password" id="login-password" name="password" required="required" placeholder="请输入您的密码">
                                    </div>
                                </div>
                                {notempty name="Think.config.app.captcha_signin"}
                                <div class="form-group">
                                    <label class="col-xs-12" for="login-password">验证码</label>
                                    <div class="col-xs-7">
                                        <input class="form-control" type="text" name="captcha" required="required" placeholder="请输入验证码">
                                    </div>
                                    <div class="col-xs-5">
                                        <img src="{:captcha_src()}" class="pull-right" id="captcha" style="cursor: pointer;" onclick="this.src='{:captcha_src()}?d='+Math.random();" title="点击刷新" alt="captcha" />
                                    </div>
                                </div>
                                {/notempty}
                                {// 登录框钩子}
                                <div class="form-group">
                                    <div class="col-xs-6">
                                        <label class="css-input switch switch-sm switch-primary">
                                            <input type="checkbox" id="login-remember-me" name="remember-me"><span></span> 7天内自动登录?
                                        </label>
                                    </div>
                                    <div class="col-xs-6">
										{notempty name="Think.config.app.api_config.wechat_signin"}
                                        <div class="font-s13 text-right push-5-t">
                                            <a class="wxbnt" href="javascript:;"><img src="__STATIC__/home/img/wx_button.png" alt="微信登录"></a>
                                        </div>
										{/notempty}
                                    </div>
                                </div>
                                <div class="form-group push-30-t">
                                    <div class="col-xs-12 col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
                                        <button class="btn btn-block btn-primary" type="submit">登 录</button>
                                    </div>
                                </div>
                            </form>
                            <!-- END Login Form -->
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- END Login Content -->

        <!-- Login Footer -->
        <div class="pulldown push-30-t text-center animated fadeInUp">
            <small class="text-muted"><span class="js-year-copy"></span> &copy; ZZMIND.COM {:config('mind.product_version')}</small>
        </div>
        <!-- END Login Footer -->

        <!-- OneUI Core JS: jQuery, Bootstrap, slimScroll, scrollLock, Appear, CountTo, Placeholder, Cookie and App.js -->
        <script src="__ADMIN_JS__/core/jquery.min.js"></script>
        <script src="__ADMIN_JS__/core/bootstrap.min.js"></script>
        <script src="__ADMIN_JS__/core/jquery.slimscroll.min.js"></script>
        <script src="__ADMIN_JS__/core/jquery.scrollLock.min.js"></script>
        <script src="__ADMIN_JS__/core/jquery.appear.min.js"></script>
        <script src="__ADMIN_JS__/core/jquery.countTo.min.js"></script>
        <script src="__ADMIN_JS__/core/jquery.placeholder.min.js"></script>
        <script src="__ADMIN_JS__/core/js.cookie.min.js"></script>
        <script src="__ADMIN_JS__/app.js"></script>

        <!-- Page JS Plugins -->
        <script src="__LIBS__/jquery-validation/jquery.validate.min.js"></script>
        <script src="__LIBS__/bootstrap-notify/bootstrap-notify.min.js"></script>
        <script src="__LIBS__/sweetalert/sweetalert.min.js"></script>
		<script src="__LIBS__/layui/layui.js"></script>

        <!-- Page JS Code -->
        <script src="__ADMIN_JS__/mind.js"></script>
        <script>
            $(document).ready(function () {
                $('.signin-form').on('submit', function () {
                    var $data = $(this).serialize();

                    mindEnv.loading();
                    $.post($(this).attr('action'), $data, function (res) {
                        mindEnv.loading('hide');
                        if (res.code) {
                            mindEnv.notify('登录成功，页面即将跳转~', 'success');
                            setTimeout(function () {
                                location.href = res.url;
                            }, 1500);
                        } else {
                            $('#captcha').click();
                            mindEnv.notify(res.msg, 'danger');
                        }
                    }).fail(function () {
                        mindEnv.loading('hide');
                        mindEnv.notify('服务器错误~', 'danger');
                    });
                    return false;
                });
				layui.use(['form', 'layer'], function() {
					var form = layui.form;
					var layer = layui.layer;
					{notempty name="Think.config.app.api_config.wechat_signin"}
					$(".wxbnt").on("click", function() {
						var code = Math.floor(Math.random() * (99999 - 10000) + 10000);
						var time = 300000; //毫秒
						var once = 3000; //单次毫秒
						//倒计时5分钟
						var numx = time / once;
						var getcode = function(){
							layer.open({
								type: 1,
								title: '手机微信扫一扫',
								time:time,
								skin: 'layui-layer-lan',
								area: ['290px', '300px'], //宽高
								content: '<img class="margin-auto layui-show push-20-t" src="{:home_url("api/qrcode/index")}?code='+ code +'">',
								success: function(layero, index){
									//倒数计时
									var  timeoff = function(){
										numx--;
										//每两秒一次
										if(numx>0){
											$.post("{:home_url('api/qrcode/code')}", {'code': code}, function(res) {
												//layer.msg(JSON.stringify(data.field));
												if (res.code == 0) {
													return false;
												} else {
													//layer.msg(res.msg);
													setTimeout("location.reload()", 100);
													return false;
												}
											})
										}else{
											return false;
										}
										setTimeout(timeoff,once)		
									}
									timeoff();
								},
								cancel: function(index, layero){
									numx = 0;
									layer.close(index);
								}
							});
						}
						getcode();
					});
					{/notempty}
				});
            });
        </script>
    </body>
</html>